﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Data.Common;

namespace Pencas.Models
{
    public class DAOEquipo
    {
        private string connectionString = /*ConfigurationManager.ConnectionStrings["mydb"].ToString();*/"Data Source=GABRIEL-PC;Initial Catalog=PencasUruguayo;Integrated Security=True; MultipleActiveResultSets=True;";

        public string GetNombreEquipoPorId(int id)
        {
            SQLServerConnection connection = SQLServerConnection.GetInstance(connectionString);
            string retorno = "Ninguno";
            string consulta = String.Format("SELECT * FROM Equipo WHERE id = {0}", id);
            DbDataReader reader = connection.Execute(consulta);
            if (reader.Read())
            {
                retorno = reader.GetString(1);
            }
            return retorno;
        }
    }
}